home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2001 May / SGI IRIX Base Documentation 2001 May.iso / usr / share / catman / p_man / cat3 / standard / floor.z / floor
Encoding:
Text File  |  1998-10-30  |  13.0 KB  |  199 lines

  1.  
  2.  
  3.  
  4. FFFFLLLLOOOOOOOORRRR((((3333MMMM))))                                                            FFFFLLLLOOOOOOOORRRR((((3333MMMM))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      floor, floorl, ffloor, floorf, ceil, ceill, fceil, ceilf, copysign,
  10.      copysignl, drem, dreml, fmod, fmodl, fmodf, fabsl, fabs, fabsf,
  11.      remainder, rint, rintl, trunc, truncl, ftrunc, truncf - floor, ceiling,
  12.      remainder, absolute value, nearest integer, and truncation functions
  13.  
  14. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  15.      ####iiiinnnncccclllluuuuddddeeee <<<<mmmmaaaatttthhhh....hhhh>>>>
  16.  
  17.      ddddoooouuuubbbblllleeee fffflllloooooooorrrr ((((ddddoooouuuubbbblllleeee xxxx))));;;;
  18.      lllloooonnnngggg ddddoooouuuubbbblllleeee fffflllloooooooorrrrllll ((((lllloooonnnngggg ddddoooouuuubbbblllleeee xxxx))));;;;
  19.      ffffllllooooaaaatttt fffffffflllloooooooorrrr ((((ffffllllooooaaaatttt xxxx))));;;;
  20.      ffffllllooooaaaatttt fffflllloooooooorrrrffff ((((ffffllllooooaaaatttt xxxx))));;;;
  21.  
  22.      ddddoooouuuubbbblllleeee cccceeeeiiiillll ((((ddddoooouuuubbbblllleeee xxxx))));;;;
  23.      lllloooonnnngggg ddddoooouuuubbbblllleeee cccceeeeiiiillllllll ((((lllloooonnnngggg ddddoooouuuubbbblllleeee xxxx))));;;;
  24.      ffffllllooooaaaatttt ffffcccceeeeiiiillll ((((ffffllllooooaaaatttt xxxx))));;;;
  25.      ffffllllooooaaaatttt cccceeeeiiiillllffff ((((ffffllllooooaaaatttt xxxx))));;;;
  26.  
  27.      ddddoooouuuubbbblllleeee ccccooooppppyyyyssssiiiiggggnnnn ((((ddddoooouuuubbbblllleeee xxxx,,,, ddddoooouuuubbbblllleeee yyyy))));;;;
  28.      lllloooonnnngggg ddddoooouuuubbbblllleeee ccccooooppppyyyyssssiiiiggggnnnnllll \\\\
  29.                ((((lllloooonnnngggg ddddoooouuuubbbblllleeee xxxx,,,, lllloooonnnngggg ddddoooouuuubbbblllleeee yyyy))));;;;
  30.  
  31.      ddddoooouuuubbbblllleeee ddddrrrreeeemmmm ((((ddddoooouuuubbbblllleeee xxxx,,,, ddddoooouuuubbbblllleeee yyyy))));;;;
  32.      lllloooonnnngggg ddddoooouuuubbbblllleeee ddddrrrreeeemmmmllll \\\\
  33.                ((((lllloooonnnngggg ddddoooouuuubbbblllleeee xxxx,,,, lllloooonnnngggg ddddoooouuuubbbblllleeee yyyy))));;;;
  34.  
  35.      ddddoooouuuubbbblllleeee rrrreeeemmmmaaaaiiiinnnnddddeeeerrrr ((((ddddoooouuuubbbblllleeee xxxx,,,, ddddoooouuuubbbblllleeee yyyy))));;;;
  36.  
  37.      ddddoooouuuubbbblllleeee ttttrrrruuuunnnncccc ((((ddddoooouuuubbbblllleeee xxxx))));;;;
  38.      lllloooonnnngggg ddddoooouuuubbbblllleeee ttttrrrruuuunnnnccccllll ((((lllloooonnnngggg ddddoooouuuubbbblllleeee xxxx))));;;;
  39.      ffffllllooooaaaatttt ffffttttrrrruuuunnnncccc ((((ffffllllooooaaaatttt xxxx))));;;;
  40.      ffffllllooooaaaatttt ttttrrrruuuunnnnccccffff ((((ffffllllooooaaaatttt xxxx))));;;;
  41.  
  42.      ddddoooouuuubbbblllleeee ffffmmmmoooodddd ((((ddddoooouuuubbbblllleeee xxxx,,,, ddddoooouuuubbbblllleeee yyyy))));;;;
  43.      lllloooonnnngggg ddddoooouuuubbbblllleeee ffffmmmmooooddddllll \\\\
  44.                ((((lllloooonnnngggg ddddoooouuuubbbblllleeee xxxx,,,, lllloooonnnngggg ddddoooouuuubbbblllleeee yyyy))));;;;
  45.      ffffllllooooaaaatttt ffffmmmmooooddddffff ((((ffffllllooooaaaatttt xxxx,,,, ffffllllooooaaaatttt yyyy))));;;;
  46.  
  47.      ddddoooouuuubbbblllleeee ffffaaaabbbbssss ((((ddddoooouuuubbbblllleeee xxxx))));;;;
  48.      lllloooonnnngggg ddddoooouuuubbbblllleeee ffffaaaabbbbssssllll ((((lllloooonnnngggg ddddoooouuuubbbblllleeee xxxx))));;;;
  49.      ffffllllooooaaaatttt ffffaaaabbbbssssffff ((((ffffllllooooaaaatttt xxxx))));;;;
  50.  
  51.      ddddoooouuuubbbblllleeee rrrriiiinnnntttt ((((ddddoooouuuubbbblllleeee xxxx))));;;;
  52.      lllloooonnnngggg ddddoooouuuubbbblllleeee rrrriiiinnnnttttllll ((((lllloooonnnngggg ddddoooouuuubbbblllleeee xxxx))));;;;
  53.  
  54. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  55.      The _f_m_o_d, _f_a_b_s, and _t_r_u_n_c functions listed above, as well as the long
  56.      double and single-precision versions of the remaining functions, are only
  57.      available in the standard math library, -_l_m, and in -_l_m_x.
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. FFFFLLLLOOOOOOOORRRR((((3333MMMM))))                                                            FFFFLLLLOOOOOOOORRRR((((3333MMMM))))
  71.  
  72.  
  73.  
  74.      The _f_l_o_o_r functions return the largest integer not greater than _x.  The
  75.      argument _x is ddddoooouuuubbbblllleeee for _f_l_o_o_r, lllloooonnnngggg ddddoooouuuubbbblllleeee for _f_l_o_o_r_l, and ffffllllooooaaaatttt for
  76.      _f_f_l_o_o_r and its ANSI-named equivalent _f_l_o_o_r_f.
  77.  
  78.      _c_o_p_y_s_i_g_n(_x,_y) returns the number with the magnitude of _x and the sign of
  79.      _y.  _c_o_p_y_s_i_g_n_l is the lllloooonnnngggg ddddoooouuuubbbblllleeee counterpart of copysign.
  80.  
  81.      _d_r_e_m(_x,_y) returns the remainder r := x - n*y where n is the integer
  82.      nearest the exact value of x/y; moreover if |n-x/y|=1/2 then n is even.
  83.      Consequently the remainder is computed exactly and |r| _< |y|/2.  But
  84.      _d_r_e_m(_x,_0) is exceptional; see below under DIAGNOSTICS.  _r_e_m_a_i_n_d_e_r is an
  85.      alternate entry point for _d_r_e_m.  _d_r_e_m_l is the lllloooonnnngggg ddddoooouuuubbbblllleeee counterpart of
  86.      drem.
  87.  
  88.      The _c_e_i_l functions return the smallest integer not less than _x.  The
  89.      argument _x is ddddoooouuuubbbblllleeee for _c_e_i_l, lllloooonnnngggg ddddoooouuuubbbblllleeee for _c_e_i_l_l, and ffffllllooooaaaatttt for _f_c_e_i_l
  90.      and its ANSI-named equivalent _c_e_i_l_f.
  91.  
  92.      The _t_r_u_n_c functions return the integer (represented as a floating-point
  93.      number) of _x with the fractional bits truncated.  The argument _x is
  94.      ddddoooouuuubbbblllleeee for _t_r_u_n_c, lllloooonnnngggg ddddoooouuuubbbblllleeee for _t_r_u_n_c_l, and ffffllllooooaaaatttt for _f_t_r_u_n_c.
  95.  
  96.      _f_a_b_s returns the absolute value of the ddddoooouuuubbbblllleeee _x, |_x|.  It also has
  97.      counterparts of type lllloooonnnngggg ddddoooouuuubbbblllleeee and ffffllllooooaaaatttt,,,, namely _f_a_b_s_l, and _f_a_b_s_f,
  98.      respectively.
  99.  
  100.      _r_i_n_t returns the integer (represented as a double precision number)
  101.      nearest its ddddoooouuuubbbblllleeee argument _x in the direction of the prevailing rounding
  102.      mode.  _r_i_n_t_l is the lllloooonnnngggg ddddoooouuuubbbblllleeee counterpart of rint.  _r_i_n_t has no
  103.      counterpart which accepts an argument of type ffffllllooooaaaatttt.
  104.  
  105.      _f_m_o_d returns the floating-point remainder of the division of its ddddoooouuuubbbblllleeee
  106.      arguments _x by _y.  It returns a number _f with the same sign as _x, such
  107.      that _x = _i_y + _f for some integer _i, and |_f| < |_y|.  Hence both the
  108.      invocations
  109.           fmod(2.5,1.0)
  110.           fmod(2.5,-1.0)
  111.      yield 0000....5555, while the two invocations
  112.           fmod(-2.5,1.0)
  113.           fmod(-2.5,-1.0)
  114.      yield ----0000....5555.
  115.      _f_m_o_d_l is the counterpart of _f_m_o_d which accepts and returns values of type
  116.      lllloooonnnngggg ddddoooouuuubbbblllleeee and _f_m_o_d_f is the counterpart of _f_m_o_d which accepts and
  117.      returns values of type ffffllllooooaaaatttt.
  118.  
  119. DDDDIIIIAAAAGGGGNNNNOOOOSSSSTTTTIIIICCCCSSSS
  120.      In the diagnostics below, functions in the standard math library _l_i_b_m._a,
  121.      are referred to as -_l_m versions, those in math library _l_i_b_m_x._a are
  122.      referred to as -_l_m_x versions, and those in the the BSD math library
  123.      _l_i_b_m_4_3._a are referred to as -_l_m_4_3 versions.  The -_l_m and -_l_m_x versions
  124.      always return the default Quiet NaN and set _e_r_r_n_o to EDOM when a NaN is
  125.      used as an argument.  A NaN argument usually causes the -_l_m_4_3 versions to
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. FFFFLLLLOOOOOOOORRRR((((3333MMMM))))                                                            FFFFLLLLOOOOOOOORRRR((((3333MMMM))))
  137.  
  138.  
  139.  
  140.      return the same argument.  The -_l_m_4_3 versions never set _e_r_r_n_o.  The value
  141.      of HUGE_VAL is IEEE Infinity.
  142.  
  143.      If _y (and, possibly, _x) are zero, or if _x is +/-HUGE_VAL, the _f_m_o_d
  144.      functions return a quiet NaN, and set _e_r_r_n_o to EDOM.
  145.  
  146.      IEEE 754 defines _d_r_e_m(_x,_0) and _d_r_e_m(_i_n_f_i_n_i_t_y,_y) to be invalid operations
  147.      that produce a _N_a_N.
  148.  
  149.      A version of the double-precision _f_a_b_s function exists in the C library
  150.      as well.  The C library version may not behave correctly when the input
  151.      is NaN.
  152.  
  153. NNNNOOOOTTTTEEEESSSS
  154.      Long double operations on this system are only supported in round to
  155.      nearest rounding mode (the default).  The system must be in round to
  156.      nearest rounding mode when calling any of the long double functions, or
  157.      incorrect answers will result.
  158.  
  159.      Users concerned with portability to other computer systems should note
  160.      that the long double and float versions of these functions are optional
  161.      according to the ANSI C Programming Language Specification ISO/IEC 9899 :
  162.      1990 (E).
  163.  
  164.      Long double functions have been renamed to be compliant with the ANSI-C
  165.      standard, however to be backward compatible, they may still be called
  166.      with the double precision function name prefixed with a q.  (Exceptions:
  167.      functions _f_a_b_s_l and _f_m_o_d_l may be called with names _q_a_b_s and _q_m_o_d, resp.)
  168.  
  169.      In the default rounding mode, round to nearest, _r_i_n_t(_x) is the integer
  170.      nearest _x with the additional stipulation that if |rint(x)-x|=1/2 then
  171.      _r_i_n_t(_x) is even.  Other rounding modes can make _r_i_n_t act like _f_l_o_o_r, or
  172.      like _c_e_i_l, or round towards zero.
  173.  
  174.      Another way to obtain an integer near x is to declare (in C)
  175.           double x;     int k;    k = x;
  176.      The C compilers round _x towards zero to get the integer _k.  Also note
  177.      that, if _x is larger than _k can accommodate, the value of _k and the
  178.      presence or absence of an integer overflow are hard to detect.
  179.  
  180.      IEEE 754 requires _c_o_p_y_s_i_g_n(_x,_N_a_n) = +_x.  In this implementation of
  181.      _c_o_p_y_s_i_g_n, the sign of NaN is ignored.  Thus _c_o_p_y_s_i_g_n(_x,+__N_a_N) = +_x, and
  182.      _c_o_p_y_s_i_g_n(+__N_a_N,_x) = +_N_a_N.
  183.  
  184. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  185.      abs(3C), math(3M), matherr(3M)
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.